enyo.kind({
	name: "enyo.PanelContent",
	kind: enyo.VFlexBox,
	published: {
		headerContent: "",
		submitLeftContent: "",
		submitRightContent: ""
	},
	events: {
		onSubmitLeft: "",
		onSubmitRight: "",
		onBack: "",
		onSignOut: "",
		onHeaderClick: ""
	},
	components: [
		{name: "header", kind: "Header", className: "enyo-header black-bg", components: [
			{kind: "HtmlContent", name: "headerContent", onclick: "doHeaderClick"},
			{kind: "Spacer"},
			{content: "[Sign Out]", name: "signOutButton", onclick: "doSignOut"}
		]},
		{kind: "Scroller", flex: 1, className: "black-bg", components: [
			{name: "client"}
		]},
		{kind: "Toolbar", className: "enyo-footer black-bg", components: [
			{kind: "GrabButton", onclick: "doBack"},
			{name: "submitLeft", onclick: "doSubmitLeft"},
			{name: "submitRight", onclick: "doSubmitRight"}
		]}
	],
	create: function() {
		this.inherited(arguments);
		this.headerContentChanged();
	},
	headerContentChanged: function() {
		if(enyo.Data.current_user == null){
			this.$.headerContent.setContent(this.headerContent);
			this.$.signOutButton.setShowing(false);
		}else{
			this.$.headerContent.setContent(this.headerContent + "  [" + enyo.Data.current_user + "]");
		}
		if(this.submitLeftContent == "") {
			this.$.submitLeft.setShowing(false);
		} else {
			this.$.submitLeft.setShowing(true);
			this.$.submitLeft.setCaption(this.submitLeftContent);
		}
		if(this.submitRightContent == "") {
			this.$.submitRight.setShowing(false);
		} else {
			this.$.submitRight.setShowing(true);
			this.$.submitRight.setCaption(this.submitRightContent);
		}
	}
});
